const state = {
  // qrcodeTextContent: [],
  // qrcodeVisible: false,
  qrcodeShowData: { qrcodeVisible: false, qrcodeTextContent: [], config: {} },
}
const mutations = {
  // qrcodeShowData
  SET_QRCODESHOWDATA: (state, qrcodeShowData) => {
    if (qrcodeShowData.data.length > 0) {
      state.qrcodeShowData = {
        qrcodeVisible: true,
        qrcodeTextContent: qrcodeShowData.data,
        config: qrcodeShowData.config,
      }
      // state.qrcodeShowData.qrcodeVisible = true
      // state.qrcodeShowData.qrcodeTextContent = qrcodeShowData.data
      // state.qrcodeShowData.config = qrcodeShowData.config
    } else {
      state.qrcodeShowData = {
        qrcodeVisible: false,
        qrcodeTextContent: [],
        config: {},
      }
    }
  },
  SET_QRCODEVISIBLE: (state, isShow) => {
    state.qrcodeVisible = isShow
  },
}

const actions = {
  setQRCodeShowData({ commit }, texts) {
    commit('SET_QRCODESHOWDATA', texts)
  },
  setCloseQRCode({ commit }) {
    commit('SET_QRCODESHOWDATA', { data: [] })
  },
}

export default {
  namespaed: true,
  state,
  mutations,
  actions,
}
